Skip to content

Conversation

khelif96
Copy link

deep-object-diff will now type the return type based off of the two objects passed in.

  const result = diff(
    {
      some: "value",
      deep: {
        nested: {
          property: "value",
          array: [1, 2, 3],
        },
      },
    },
    { some: "value", other: 1 }
  );

  result.deep.nested.property; // $ExpectType string
  result.some; // $ExpectType string
  result.other; // $ExpectType number
  result.deep.nested.array; // $ExpectType number[]

`deep-object-diff` will now type the return type based off of the two objects passed in. 

```
  const result = diff(
    {
      some: "value",
      deep: {
        nested: {
          property: "value",
          array: [1, 2, 3],
        },
      },
    },
    { some: "value", other: 1 }
  );

  result.deep.nested.property; // $ExpectType string
  result.some; // $ExpectType string
  result.other; // $ExpectType number
  result.deep.nested.array; // $ExpectType number[]
```
@khelif96
Copy link
Author

Sorry realized this is a Duplicate of #48

@khelif96 khelif96 closed this Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant